/**
 * Created by 000188 on 2016/6/24.
 */
var webpack = require('webpack');
var path = require('path');
var htmlWebpackPlugin = require('html-webpack-plugin');
var CleanWebpackPlugin = require('clean-webpack-plugin');

module.exports = {
    entry: {
        index: ['index']
    },
    output: {
        filename: '[name].js',
        chunkFilename: '[chunkhash].js',
        path: path.resolve(__dirname, 'dist/static'),
        publicPath: 'static/'
    },
    resolve: {
        root: [
            path.resolve('./src/js'),
            path.resolve('./src/js/assembly'),
            path.resolve('./src/js/scene')
        ]
    },
    module: {
        loaders: [
            {test: /\.jsx?$/, exclude: /node_modules/, loaders: ['react-hot', 'babel']},
            {
                test: /\.css$/,
                loaders: ['style', 'css']
            },
            {test: /\.(png|jpg)$/, loader: 'url-loader?limit=10240'}
        ]
    },
    plugins: [
        new CleanWebpackPlugin(['dist'], {
            root: __dirname,
            verbose: true
        }),
        new webpack.DefinePlugin({
            "process.env": {
                NODE_ENV: JSON.stringify("production")
            }
        }),
        new htmlWebpackPlugin({
            title: '东航红包，倾情放送 - 中国东方航空',
            filename: '../index.html'
        })
    ]
}

